<?php

App::uses('PST_SELECT', 'Presentation');

class PST_PROBLEMAS extends PST_SELECT {

    public function __construct($settings) {
        $this->model = 'Problema';
        parent::__construct($settings);
    }

    protected function getHelperValue() {
        if (isset($this->model_obj)) {
            $sql = array(
                'fields' => array("Tipo.nombre", "Problema.descripcion"),
                'conditions' => array("Problema.id" => $this->value),
            );

            $array = $this->model_obj->find('all', $sql);
            $array = reset($array);
            return $array['Tipo']['nombre'] . " > " . $array['Problema']['descripcion'];
        }
        return $this->value;
    }

}
